<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <%@page isELIgnored="false" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String userid = "";
if (request.getAttribute("userid") != null) {
	userid = request.getAttribute("userid").toString();
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>迟到早退规则设置</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link id="bootstrap-style" href="<c:url value="/css/bootstrap.min.css"/>" rel="stylesheet">
	<link href="<c:url value="/css/bootstrap-responsive.min.css"/>" rel="stylesheet">
	<link id="base-style" href="<c:url value="/css/style.css"/>" rel="stylesheet">
	<link id="base-style-responsive" href="<c:url value="/css/style-responsive.css"/>" rel="stylesheet">
	<link href="<c:url value="/css/index.css"/>" rel="stylesheet">
	<link rel="shortcut icon" href="<c:url value="/img/favicon.ico"/>">
	<link href="<c:url value="/css/page.css"/>" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="<c:url value="/css/jquery.datetimepicker.css"/>"/>
	<link href="<c:url value="/css/navuser.css"/>" rel="stylesheet">
	<link href="<c:url value="/css/but.css"/>" rel="stylesheet">
	<script src="<c:url value="/js/jquery-1.9.1.min.js"/>"></script>
	<script src="<c:url value="/js/jquery-migrate-1.0.0.min.js"/>"></script>
	<script type="text/javascript" src="<c:url value="/js/layer/layer.js"/>"></script>
	<script src="<c:url value="/js/laydate/laydate.js"/>"></script>
	<script src="<c:url value="/js/build/jquery.datetimepicker.full.js"/>"></script>
	<script src="<c:url value="/js/orgin.js"/>"></script>
	<script src="<c:url value="/js/filebut.js"/>"></script>
</head>
 <script type="text/javascript">
 $(function(){ 
	 document.getElementById("a1").style.color = "#37c2c2";
	 var msg="${msg}";
	 if(msg!=null&&msg!=""){
		 alert(msg);
	 }
 }); 
 
 
 var i="${maximumid}";
 
 
 function closebutton() {
	var index = parent.layer.getFrameIndex(window.name);  
 	parent.layer.close(index);  
 }
 
 function addTr2(tab, row){
	 	i++;
	 	var trHtml="<div id='divid"+i+"' style='padding-left: 100px;'>"+
		"<div style='width:70%;text-align: left;'>"+
		"<span>迟到<input type='text' class='input30' style='border-top: none;border-left: none;border-right: none;'>"+
		"&nbsp;分钟到<input type='text' class='input30' style='border-top: none;border-left: none;border-right: none;'>"+
		"&nbsp;分钟，每次扣款<input type='text' class='input30' style='border-top: none;border-left: none;border-right: none;'>元</span>"+
		"&nbsp;&nbsp;&nbsp;&nbsp;<a href='#' onclick=\"removeRow('#divid"+i+"')\">"+
		"<img  src='<%=basePath%>img/youlingimg/delete.png'>"+
		"</a>"+
		"</div>"+
		"</div>";
		$("#parent").append(trHtml);  
}
 
 function addTr3(tab, row){
	 	i++;
	 	var trHtml="<div id='divid"+i+"' style='padding-left: 100px;'>"+
		"<div style='width:70%;text-align: left;'>"+
		"<span>超出<input type='text' class='input32' style='border-top: none;border-left: none;border-right: none;'>"+
		"&nbsp;分钟到<input type='text' class='input32' style='border-top: none;border-left: none;border-right: none;'>"+
		"&nbsp;分钟，每次扣款<input type='text' class='input32' style='border-top: none;border-left: none;border-right: none;'>元</span>"+
		"&nbsp;&nbsp;&nbsp;&nbsp;<a href='#' onclick=\"removeRow('#divid"+i+"')\">"+
		"<img  src='<%=basePath%>img/youlingimg/delete.png'>"+
		"</a>"+
		"</div>"+
		"</div>";
		$("#parent1").append(trHtml);  
}

function submitForm(){
	var list=document.getElementsByClassName("input30");
	var tiem="";
	var reg = /\s/;
	var l=0;
	for(var j=0;j<list.length;j++){
		if(reg.exec(list[j].value)!=null){
			alert('不允许输入空格！');
			return;
		}
		if(list[j].value==""||list[j].value==null){
			alert("时间不允许为空！");
			return;
		}
		if(l%3<2){
			tiem+=list[j].value+",";
		}else{
			tiem+=list[j].value+";";
		}
		l++;
	}
	$("#tiems").val(tiem);
	$("#type").val(1);
	document.forms["frm"].submit();
}

function submitForm2(){
	var list=document.getElementsByClassName("input32");
	var tiem="";
	var reg = /\s/;
	var l=0;
	for(var j=0;j<list.length;j++){
		if(reg.exec(list[j].value)!=null){
			alert('不允许输入空格！');
			return;
		}
		if(list[j].value==""||list[j].value==null){
			alert("时间不允许为空！");
			return;
		}
		if(l%3<2){
			tiem+=list[j].value+",";
		}else{
			tiem+=list[j].value+";";
		}
		l++;
	}
	$("#tiemss").val(tiem);
	$("#type").val(2);
	document.forms["frm"].submit();
}

//删除行
function removeRow(obj){  
	$(obj).remove();  
}  

function ChangeDiv(divId,divName,zDivCount) { 
	if(divId == '0'){
		document.getElementById("a1").style.color = "#37c2c2";
	}else{
		document.getElementById("a1").style.color = "black";
	}
	
	if(divId == '1'){
		document.getElementById("a2").style.color = "#37c2c2";
	}else{
		document.getElementById("a2").style.color = "black";
	}
	
	for(i=0;i<=zDivCount;i++) 	{ 
		document.getElementById(divName+i).style.display="none"; 
		//将所有的层都隐藏 
	} 
	document.getElementById(divName+divId).style.display="block";
	//显示当前层 
	
}
 
 
 </script>
<style type="text/css">
 
 .input30{
	 width: 50px;
	 text-align: center;
 }
 .input31{
	 width: 50px;
	 text-align: center;
 }
 
  .input32{
	 width: 50px;
	 text-align: center;
 }
 </style>
<body>
<div class="container-fluid-full">
	<div class="row-fluid">
			<div id="content" class="span10" style="background-color:#F9F9F9;">
<form name="frm" id="frm" method="post" action="<%=basePath%>salaryc/insert" enctype="multipart/form-data">
				<input type="hidden" id="tiems" name="tiems" value=""> 
				<input type="hidden" id="type" name="type" value=""> 
				<div id="nav">
					<ul style="width: 100%;">
						<li><a id="a1" onclick="JavaScript:ChangeDiv('0','JKDiv_',1)" style="cursor:hand;"><h2>迟到扣款规则</h2></a></li>
						<li><a id="a2" onclick="JavaScript:ChangeDiv('1','JKDiv_',1)" style="cursor:hand;"><h2>早退扣款规则</h2></a></li>
					</ul>
					<div style="clear:both"></div>
				</div>
				
				<div style="background-color:#FFF;">
			<!-- 	<div style="margin-top:-10px;margin-top:-10px;margin-bottom:20px;margin-left:20px;margin-right:20px;padding-top:20px;">
					<span style="color:#37c2c2">薪酬计算规则</span>
				</div> 
					 <div id="JKDiv_0" style="font-size:14px;margin:30px;">
						<div style="padding-left: 100px;">
							<div style="width:70%;text-align: left;">
								<span>缺勤扣款 = 基本工资 ×
								<input type="text" class="input30" style="border-top: none;border-left: none;border-right: none;">/
								<input type="text" class="input30" style="border-top: none;border-left: none;border-right: none;">
								× 缺勤天数</span>
							</div>
							<div style="width:70%;text-align: left;">
								<span>事假扣款 = 基本工资 ×
								<input type="text" class="input30" style="border-top: none;border-left: none;border-right: none;">/
								<input type="text" class="input30" style="border-top: none;border-left: none;border-right: none;">/
								<input type="text" class="input30" style="border-top: none;border-left: none;border-right: none;">
								× 事假折算出的小时数</span>
							</div>
							<div style="width:70%;text-align: left;">
								<span>病假扣款 = 基本工资 ×
								<input type="text" class="input30" style="border-top: none;border-left: none;border-right: none;">/
								<input type="text" class="input30" style="border-top: none;border-left: none;border-right: none;">/
								<input type="text" class="input30" style="border-top: none;border-left: none;border-right: none;">
								× 病假折算出的小时数</span>
							</div>
							<div style="width:70%;text-align: left;">
								<span>加班工资 = 基本工资 ×
								<input type="text" class="input30" style="border-top: none;border-left: none;border-right: none;">/
								<input type="text" class="input30" style="border-top: none;border-left: none;border-right: none;">/
								<input type="text" class="input30" style="border-top: none;border-left: none;border-right: none;">
								× (平时加班×<input type="text" class="input30" style="border-top: none;border-left: none;border-right: none;">
								+ 周末加班 ×<input type="text" class="input30" style="border-top: none;border-left: none;border-right: none;">
								+ 法定加班 ×<input type="text" class="input30" style="border-top: none;border-left: none;border-right: none;">)</span>
							</div>
						</div>
					</div> -->
					
				<!-- 迟到 -->
				<div id="JKDiv_0" style="font-size:14px;margin:30px;">
					<div style="margin-top:-10px;margin-top:-10px;margin-bottom:20px;margin-left:20px;margin-right:20px;padding-top:20px;">
						<span style="color:#37c2c2">迟到扣款规则</span>
					</div>
					<div id="JKDiv_0" style="font-size:14px;margin:30px;">
						<div style="padding-left: 100px;">
							<div style="width:70%;text-align: left;">
								<span>每月前<input type="text" id="frequency"  name="frequency" value="${frequency }" class="input31" style="border-top: none;border-left: none;border-right: none;">次迟到不扣款</span>
							</div>
						</div>
						<c:forEach items="${latelist }" var="a">
							<div style="padding-left: 100px;">
								<div style="width:70%;text-align: left;">
									<span>迟到<input type="text" id="starminutes" name="starminutes" value="${a.starminutes }" class="input30" style="border-top: none;border-left: none;border-right: none;">
									分钟到<input type="text" id="endminutes" name="endminutes" value="${a.endminutes }" class="input30" style="border-top: none;border-left: none;border-right: none;">
									分钟，每次扣款<input type="text" id="money" name="money" value="${a.money }" class="input30" style="border-top: none;border-left: none;border-right: none;">元</span>
									&nbsp;&nbsp;<a href='#' onclick=\"removeRow('#divid"+3+"')\">
									<img  src='<%=basePath%>img/youlingimg/delete.png'>
									</a>
								</div>
							</div>
						</c:forEach>
						<div id="parent"></div> 
					</div>
					<div class="row-fluid content-table">
				<table class="table  bootstrap-datatable" style=" border:none; border-spacing:0; border-collapse:collapse;margin:0;padding:0">
					  <tbody>
						<tr class="content-search" style="text-align: center;">
							<td colspan="6">
								<div>
									<button  class="but" type="button" onclick="addTr2('tab',-3);" id="output">增加班次时间</button>
								</div>
							</td>
						</tr>
						<tr class="content-search" style="text-align: center;">
							<td colspan="6">
								<div>
									<button type="button" class="but" id="saveUser" onclick="submitForm();">保存</button>
								</div>
							</td>
						</tr>
					  </tbody>
				</table>            
			</div>
			</div>
			
			<input type="hidden" id="tiemss" name="tiemss" value=""> 
			<!-- 早退 -->	
			<div id="JKDiv_1" style="display:none;font-size:14px;margin:30px;">
			<div style="margin-top:-10px;margin-top:-10px;margin-bottom:20px;margin-left:20px;margin-right:20px;padding-top:20px;">
				<span style="color:#37c2c2">早退扣款规则</span>
			</div>
			<div id="JKDiv_1" style="font-size:14px;margin:30px;">
						<div style="padding-left: 100px;">
							<div style="width:70%;text-align: left;">
								<span>每月累计早退时间少于<input type="text" id="frequencyEarly"  name="frequencyEarly" value="${time}" class="input31" style="border-top: none;border-left: none;border-right: none;">分钟不扣款</span>
							</div>
						</div>
						<c:forEach items="${retreatlist}" var="a">
							<div style="padding-left: 100px;">
								<div style="width:70%;text-align: left;">
									<span>超出<input type="text" id="starminutes" name="starminutes" value="${a.starminutes }" class="input32" style="border-top: none;border-left: none;border-right: none;">
									分钟到<input type="text" id="endminutes" name="endminutes" value="${a.endminutes }" class="input32" style="border-top: none;border-left: none;border-right: none;">
									分钟，每次扣款<input type="text" id="money" name="money" value="${a.money }" class="input32" style="border-top: none;border-left: none;border-right: none;">元</span>
									&nbsp;&nbsp;<a href='#' onclick=\"removeRow('#divid"+i+"')\">
									<img  src='<%=basePath%>img/youlingimg/delete.png'>
									</a>
								</div>
							</div>
						</c:forEach>
						<div id="parent1"></div> 
					</div>
					<div class="row-fluid content-table">
				<table class="table  bootstrap-datatable" style=" border:none; border-spacing:0; border-collapse:collapse;margin:0;padding:0">
					  <tbody>
						<tr class="content-search" style="text-align: center;">
							<td colspan="6">
								<div>
									<button  class="but" type="button" onclick="addTr3('tab',-3);" id="output">增加班次时间</button>
								</div>
							</td>
						</tr>
						<tr class="content-search" style="text-align: center;">
							<td colspan="6">
								<div>
									<button type="button" class="but" id="saveUser" onclick="submitForm2();">保存</button>
								</div>
							</td>
						</tr>
					  </tbody>
				</table>            
			</div>
			</div>	
			
</form>
			<!-- <div class="row-fluid content-table">
				<table class="table  bootstrap-datatable" style=" border:none; border-spacing:0; border-collapse:collapse;margin:0;padding:0">
					  <tbody>
						<tr class="content-search" style="text-align: center;">
							<td colspan="6">
								<div>
									<button  class="but" type="button" onclick="addTr2('tab',-3);" id="output">增加班次时间</button>
								</div>
							</td>
						</tr>
						<tr class="content-search" style="text-align: center;">
							<td colspan="6">
								<div>
									<button type="button" class="but" id="saveUser" onclick="submitForm();">保存</button>
								</div>
							</td>
						</tr>
					  </tbody>
				</table>            
			</div> -->
			
		</div>
	</div>
</div>
</body>
</html>
